# 设置CMAKE最低版本
cmake_minimum_required(VERSION 3.17)

# 获取当前目录名称
get_filename_component(PROJECT_DIR_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME)
set (PROJECT_NAME ${PROJECT_DIR_NAME})
message("PROJECT_NAME: ${PROJECT_NAME}")

# 设置工程名称
project(${PROJECT_NAME} LANGUAGES  C CXX)

# 设置C最低版本
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_EXTENSIONS OFF)
set(CMAKE_C_STANDARD_REQUIRED ON)

# 设置C++最低版本
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

# 头文件
file(GLOB_RECURSE HEADER_FILES
    ${CMAKE_CURRENT_SOURCE_DIR}/Inc/*.h
)

# 源文件
file(GLOB_RECURSE SOURCES_FILES
    ${CMAKE_CURRENT_SOURCE_DIR}/Src/*.c
)

# 将头文件和源文件加入到工程中
set(SOURCES
    ${SOURCES_FILES} 
    ${HEADER_FILES}
    )
message("SOURCES: ${SOURCES}")
add_executable(${PROJECT_NAME} ${SOURCES})

# 头文件目录
target_include_directories(${PROJECT_NAME} PUBLIC
    ${CMAKE_CURRENT_SOURCE_DIR}/Inc
)

# 链接目录
target_link_directories(${PROJECT_NAME} PUBLIC
    ${CMAKE_CURRENT_SOURCE_DIR}/Lib
)

# 链接库
target_link_libraries(${PROJECT_NAME} PUBLIC

)

